#include "selectcollectitem.h"
#include "ui_selectcollectitem.h"
#include<QEvent>
selectcollectitem::selectcollectitem(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::selectcollectitem)
{
    ui->setupUi(this);
}

selectcollectitem::~selectcollectitem()
{
    delete ui;
}

void selectcollectitem::init(QString name, int num)
{
    this->name=name;
    this->num = num;
    ui->collectname->setText(name);
    ui->collectnum->setText(QString::number(num));
}

bool selectcollectitem::eventFilter(QObject *watched, QEvent *event)
{
    if(watched==ui->widget)
    {
        if(event->type()==QEvent::Enter)
        {
            QPalette pa=ui->collectname->palette();
            pa.setColor(QPalette::WindowText,QColor(0,174,236));
            ui->collectname->setPalette(pa);
        }
        else if(event->type()==QEvent::Leave)
        {
            QPalette pa=ui->collectname->palette();
            pa.setColor(QPalette::WindowText,QColor(0,0,0));
            ui->collectname->setPalette(pa);
        }
    }
}
